Skip to content

Issue 52339: Try to use shorter URIs for domains when possible#6805

Merged
labkey-susanh merged 7 commits intodevelopfrom
fb_domainLsids
Jul 1, 2025
Merged

Issue 52339: Try to use shorter URIs for domains when possible#6805
labkey-susanh merged 7 commits intodevelopfrom
fb_domainLsids

Conversation

@labkey-susanh
Copy link
Contributor

@labkey-susanh labkey-susanh commented Jun 27, 2025

Rationale

Issue 52339

This doesn't address the creation of long domain URIs that might exist out there, but paves the way toward shorter URIs in other scenarios.

Related Pull Requests

Changes

  • Move getLsidPrefixDbSeq to LsidManager for better accessibility
  • Use getLsidPrefixDbSeq for creating domain URIs for lists
  • Update DefaultValueServiceImpl to try to use these shorter URIs as appropriate as well.

@labkey-susanh labkey-susanh changed the title Issue 52339: Try to use shorter URIs for domains when possibl Issue 52339: Try to use shorter URIs for domains when possible Jun 27, 2025
Copy link
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment but looks promising.

return INSTANCE;
}

public static DbSequence getLsidPrefixDbSeq(Container container, String lsidPrefix, int batchSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is safe because container RowIds are included in many LSIDs, but since containers can be moved, would it make sense to have a single sequence used server-wide?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can certainly change the usage for Lists so it uses the root container. If this method is updated now, we'd need to change the usage from the Experiment module so it can skip over LSIDs already in use from the project-scoped LSIDs.

@XingY Was there a reason not to make this server-wide when you were adding these sequences in ExperimentServiceImpl?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically we had always included folder / container as part of lsid. The change I introduced was switching from data type name to use a db sequence when generating lsid, in order to support datatype/data renaming. LSIDs are not updated during a folder move, and shouldn't cause issues/conflict.

Copy link
Contributor Author

@labkey-susanh labkey-susanh Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't a move that would cause the conflict but the restarting of the sequence if we switch it to use a different container where the conflict may occur. (Previous project's sequence value of 1 vs. new project's sequence value of 1.) But, yes, when there is a folder id in the LSID, there won't be a problem here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My future self may not thank me for this, but I'm opting for leaving the Experiment usages as is and adding a method that provides for an easy way to use a root container sequence, which we'll use for lists.

@labkey-susanh labkey-susanh marked this pull request as ready for review June 30, 2025 16:40
public static Lsid generateDomainURI(String name, Container c, KeyType keyType, @Nullable ListDefinition.Category category)
public static Lsid generateDomainURI(Container c, KeyType keyType, @Nullable ListDefinition.Category category)
{
String type = getType(keyType, category);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but surprised to see category is hard wired to picklist.
if (category != null) type = PicklistDomainKind.NAMESPACE_PREFIX;

{
String suffix = "Folder-" + container.getRowId();
return (new Lsid(DOMAIN_DEFAULT_VALUE_LSID_PREFIX, suffix, domain.getName())).toString();
DomainKind<?> kind = domain.getDomainKind();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this cause backward compatibility issue? If a default value is set prior to this change, would it be lost since the default lsid is different now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be ok because when the domain is user-defined, the objectId from the domain LSID is the same as the encoded name. I tested it locally, but it would be good to double check by creating a list while on develop that has some default values defined for properties then verifying the default values still show up when using the list on this branch.

@labkey-susanh labkey-susanh merged commit 0ce9d8d into develop Jul 1, 2025
11 checks passed
@labkey-susanh labkey-susanh deleted the fb_domainLsids branch July 1, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants